﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SprentCMS.Core.Models.ViewDatas {
    /// <summary>
    /// Base ViewData Class
    /// </summary>
    public class BaseModuleViewData : IBaseModuleViewData {
        public string CurrentMenuItem { get; set; }
        public Dictionary<string, List<ModuleBase>> Modules { get; set; }
        public string TemplateName { get; set; }
    }

    /// <summary>
    /// Module's Base Class
    /// </summary>
    public class ModuleBase {
        public int Id { get; set; }
        public string ModuleType { get; set; }
        public string ModuleName { get; set; }
        public string Title { get; set; }
        public bool ShowTitle { get; set; }
        public bool Enabled { get; set; }
        public string Position { get; set; }
        public string Description { get; set; }
        public string Menus { get; set; }
        public string BeginHTML { get; set; }
        public string EndHtml { get; set; }

        //Extension Settings
    }

    /// <summary>
    /// 分页列表
    /// </summary>
    /// <typeparam name="T">实体类型</typeparam>
    public class PagedList<T> : List<T> where T : class /*, new()*/ {
        public PagedList(List<T> list, int pageIndex, int pageCount, int totalCount, int skipCount) {
            this.AddRange(list);
            PageIndex = pageIndex;
            PageCount = pageCount;
            TotalCount = totalCount;
            SkipCount = skipCount;
        }

        public int PageIndex { get; set; }
        public int PageCount { get; set; }
        public int TotalCount { get; set; }
        public int SkipCount { get; set; }
        public int TotalPageNumber {
            get {
                return Convert.ToInt32(TotalCount - 1 / PageCount) + 1;
            }
        }
    }
}
